package com.itheima_04;

import java.io.*;

public class CopyJavaDemo01 {
    public static void main(String[] args) throws IOException {
        //根据数据源创建字符缓冲输入流对象
        BufferedReader br = new BufferedReader(new FileReader("myCharStream\\ConvrsionStreamDemo.java"));
        //根据数据元创建字符缓冲输出流对象
        BufferedWriter bw = new BufferedWriter(new FileWriter("myCharStream\\java.txt"));

        /*
        //一次读写一个字符数据
        int ch;
        while ((ch=br.read())!=-1){
            bw.write(ch);
        }
         */

        //一次读写一个字符数组数据
        char[] chs = new char[1024];
        int len;
        while ((len=br.read(chs))!=-1){
            bw.write(chs,0,len);
        }

        //释放资源
        bw.close();
        br.close();
    }
}
